package com.ex.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ex.dao.impl.ClassicDao;
import com.ex.dao.impl.TeacherDao;
import com.ex.model.TClass;
import com.ex.model.TTeacher;
import com.ex.util.Pagination;
import com.ex.util.ParentRecordFront;

@Service
public class TeacherService {

	@Autowired
	private TeacherDao teacherDao;
	@Autowired
	ClassicDao classDao ;
	
	public List<TTeacher> queryTeacher(TTeacher t){
		String sql="from TTeacher t where t.name=? and t.password=?";
		Object[] obj={t.getName(),t.getPassword()};
		List<TTeacher> teacherList=teacherDao.query(sql,obj);
		return teacherList;
	}
	
	public Object queryClass(TTeacher t){
		String hql="SELECT c.name FROM t_class c WHERE c.master_teacher=( "
				+"SELECT t.id FROM t_teacher t WHERE t.name=?) ";
		Object[] obj={t.getName()};
		List list=classDao.queryBySQL(hql, obj);
		return list.get(0);
				
	}
	
	public Pagination  queryRecordsByTeacher(TTeacher tTeacher,ParentRecordFront prf){
		
		
		return null;
	}
	
}
